//index.js
//获取应用实例
var api = require("../../api.js"),
  r = "",
  app = getApp();
import {
  $Login
} from '../../components/base.js'
Page({
  data: {
    mine_orderData: [],
    page_index: 1,
    page_size: 5,
    loading: false,
    isBottom: false,
    comp_id:''
  },
  onLoad: function(options) {
    console.log(options.comp_id)
    this.setData({
      comp_id: options.comp_id,
    })
  },
  onShow: function() {
    //初始化数据
    this.initData();
    r = this;
  },

  onReady: function() {},
  initData: function() {
    let that = this
    wx.showLoading({
      title: "数据加载中"
    });
    wx.setNavigationBarTitle({
      title: "收益订单"
    })
    const t = new Object();
    t.page_index = 1;
   
    t.comp_id = this.data.comp_id;
    t.page_size = 5;
    wx.request({
      url: api.order.comp_orders,
      data: t,
      header: {
        "content-type": "application/json"
      },
      method: 'GET',
      success(res) {
        setTimeout(() => {
          console.log(res)
          that.setData({
            mine_orderData: res.data.data
          })
          wx.hideLoading()
        }, 500)
      }
    });
  },
  /** 订单详情 */
  toOrderDetails: function(e) {
    var ordNo = e.currentTarget.dataset.ordno;
    wx.navigateTo({
      url: `../orderDetails/orderDetails?ordNo=${ordNo}`
    })
  },

  // /**
  //  * 页面相关事件处理函数--监听用户下拉动作
  //  */
  // onPullDownRefresh: function() {
  //   wx.showNavigationBarLoading(), console.log("下拉刷新"), r.initData();
  //   setTimeout(function() {
  //     wx.hideNavigationBarLoading(), wx.stopPullDownRefresh();
  //   }, 1500);
  // },
  // onReachBottom: function () {
  // },
});